package com.example.lib_common.view.provider

import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.example.lib_base.path.RouterPath
import com.example.lib_common.view.entity.UserInfo
import com.tencent.mmkv.MMKV

/**
 * 提供基本服务
 */
@Route(path = RouterPath.PATH_COMMON_PROVIDER, name = "对外暴露基础服务")
open class BaseServiceProvider : IBaseServiceProvider {
    private lateinit var mContext: Context

    override fun init(context: Context?) {
       context?.let {
           mContext=it
       }
    }

    override fun checkLoginState(): Boolean {
        val loginToken = MMKV.defaultMMKV().decodeString("token", "").toString()
        if (!loginToken.isNullOrEmpty()){
            return true
        }
        return false
    }

    override fun getLoginToken(): String {
        return MMKV.defaultMMKV().decodeString("token", "").toString()
    }

    override fun getCurrentUserInfo(): UserInfo {
        return UserInfo("张三")
    }


}